package com.xzz.skill;

/**
 * @author: hhz
 * @create: 2022-02-14 09:54
 * 540. 有序数组中的单一元素
 **/
public class SingleNonDuplicate {
    public static void main(String[] args) {
        System.out.println(singleNonDuplicate(new int[]{1,1,2,3,3,4,4,8,8}));
    }
    public static int singleNonDuplicate(int[] nums) {
        int res = nums[0];
        for (int i = 1; i < nums.length; i++) {
            res^=nums[i];
        }
        return res;
    }
}
